<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String parrentId = request.getParameter("parrentId");
	if(parrentId == null){
		parrentId = "0";		
	}
	request.setAttribute("parrentId", parrentId);
%>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=basePath%>js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="<%=basePath%>js/menu/menu.js"></script>
<title>菜单信息</title>
</head>
<body>

	<form id="myForm" method="get" action="<%=path %>/menu/list">
	<input id="parrentId" name="parrentId" value='${parrentId}' type="hidden"/>
		<table>
			<tr>
				<td colspan="2">菜单管理</td>
			</tr>			
			<tr>					
				<td><input type="button" value="添加" onclick="window.open('<%=path %>/menu/add?parrentId=${parrentId}','添加菜单')" /></td>
			</tr>
			<tr>
				<td colspan="2">
					<table width="100%">
						<tr>
							<td>编号</td>
							<td>名称</td>											
							<td>操作</td>
						</tr>
						<c:forEach var="menu" items="${menus}" varStatus="index">
						<tr>
							<td>${menu.menuId}</td>
							<td>${menu.name}</td>
							<td>
								<a href="javascript:void(0)" onclick="deleteMenu(${menu.menuId})">删除</a> 
								<a href="javascript:void(0)" onclick="window.open('menu/update?menuId=${menu.menuId}','修改信息')">更新</a>
								<a href="javascript:void(0)" onclick="updateOrderNo(${menu.menuId},'up')">上移</a>
								<a href="javascript:void(0)" onclick="updateOrderNo(${menu.menuId},'down')">下移</a>
								<c:if test="${parrentId==0}">														
								<a href="javascript:void(0)" onclick="window.open('menu/list?parrentId=${menu.menuId}','子菜单')">子菜单</a>
								</c:if>
							</td>
						</tr>
						</c:forEach>
					</table>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
